import { defineStore } from "pinia";

interface sidebarType {
  collapse: boolean;
}

export const useSidebar = defineStore({
  id: "sidebar",
  state: (): sidebarType => ({
    collapse: false,
  }),
  // 和computed的作用一样
  getters: {
    isCollapse(state) {
      return state.collapse;
    },
  },
  actions: {
    // 更改collapse的值
    changeCollapse(value) {
      this.collapse = value;
    },
  },
});
